package com.example.skillcinema.db.apis

import com.example.skillcinema.db.enums.FilmCollections
import com.example.skillcinema.db.enums.FilmOrderTypes
import com.example.skillcinema.db.enums.FilmTypes
import com.example.skillcinema.db.enums.GalleryImageTypes
import com.example.skillcinema.db.models.Film
import com.example.skillcinema.db.models.Staff
import com.example.skillcinema.db.responses.FilmResponse
import com.example.skillcinema.db.responses.FiltersResponse
import com.example.skillcinema.db.responses.ImageResponse
import com.example.skillcinema.db.responses.PersonResponse
import com.example.skillcinema.db.responses.RelatedFilmResponse
import com.example.skillcinema.db.responses.SeasonResponse
import retrofit2.http.GET
import retrofit2.http.Path
import retrofit2.http.Query

interface FilmsApi {
    @GET("v2.2/films")
    suspend fun getAll(
        @Query("countries") country: Int? = null,
        @Query("genres") genre: Int? = null,
        @Query("order") orderTypes: FilmOrderTypes = FilmOrderTypes.RATING,
        @Query("type") filmTypes: FilmTypes = FilmTypes.ALL,
        @Query("ratingFrom") ratingFrom: Float? = null,
        @Query("ratingTo") ratingTo: Float? = null,
        @Query("yearFrom") yearFrom: Int? = null,
        @Query("yearTo") yearTo: Int? = null,
        @Query("keyword") keyword: String? = null,
        @Query("page") page: Int
    ): FilmResponse

    @GET("v2.2/films")
    suspend fun getSerials(
        @Query("type") type: FilmTypes = FilmTypes.TV_SERIES,
        @Query("page") page: Int
    ): FilmResponse

    @GET("v2.2/films/{id}")
    suspend fun getById(@Path("id") id: Int): Film

    @GET("v2.2/films/collections")
    suspend fun getTopPopular(
        @Query("type") type: FilmCollections,
        @Query("page") page: Int
    ): FilmResponse

    @GET("v2.2/films/filters")
    suspend fun getFilters(): FiltersResponse

    @GET("v2.2/films/{id}/seasons")
    suspend fun getSeasons(@Path("id") id: Int): SeasonResponse

    @GET("v1/staff")
    suspend fun getStaff(@Query("filmId") filmId: Int): List<Staff>

    @GET("v1/staff/{id}")
    suspend fun getStaffDetail(@Path("id") id: Int): PersonResponse

    @GET("v2.2/films/{id}/images")
    suspend fun getGallery(
        @Path("id") id: Int,
        @Query("page") page: Int,
        @Query("type") type: GalleryImageTypes
    ): ImageResponse

    @GET("v2.2/films/{id}/similars")
    suspend fun getSimilar(@Path("id") id: Int): RelatedFilmResponse
}